package com.collect.tanzania.zhiScene.zhiWidget.zhiOptionView;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.collect.tanzania.R;

public class ZHIOptionAdjuster extends BaseQuickAdapter<ZHIOption, BaseViewHolder> {
    public ZHIOptionAdjuster() {
        super(R.layout.item_option, null);
    }

    private OptionClickListener mOptionClickListener;

    @Override
    protected void convert(BaseViewHolder helper, final ZHIOption zhiOption) {

        helper.setText(R.id.tv_title, zhiOption.getTitle());
        helper.addOnClickListener(R.id.tv_title);

        if (mOptionClickListener != null) {
            helper.getView(R.id.tv_title).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    mOptionClickListener.OnItemClick(zhiOption.getTitle());
                }
            });
        }
    }

    public void setOptionClickListener(OptionClickListener optionClickListener) {
        this.mOptionClickListener = optionClickListener;
    }

    public interface OptionClickListener {
        void OnItemClick(String title);
    }
}